
#include <iostream>
#include "../mqcommon/helpper.hpp"

int main()
{
    xgmq::FileHelper helper("../mqcommon/logger.hpp");
    DLOG("文件是否存在:%d", helper.isExits());
    DLOG("文件大小:%ld", helper.size());

    xgmq::FileHelper tmp_help("./aaa/bbb/ccc/tmp.hpp");
    if (tmp_help.isExits() == false)
    {
        // 获取目录
        std::string path = tmp_help.parentDirector("./aaa/bbb/ccc/tmp.hpp");
        if (xgmq::FileHelper(path).isExits() == false)
        {
            // 创建目录
            xgmq::FileHelper::createDirector(path);
        }
        // 创建文件
        xgmq::FileHelper::createFile("./aaa/bbb/ccc/tmp.hpp");
    }

    std::string buff;
    helper.read(buff);
    tmp_help.write(buff);

    char buff1[32];
    helper.read(buff1,8,11);
    tmp_help.write("123456789000",8,11);

    tmp_help.rename("./aaa/bbb/ccc/test.hpp");

    tmp_help.removeFile("./aaa/bbb/ccc/test.hpp");

    tmp_help.removeDirector("aaa");

    return 0;
}